#images
  = render :partial => 'photo', :collection => @photos

%h2 Upload Via SWFUpload
%div.message
  Select your images using the browse button below. Once you have selected all your images then click the "Upload x Files" button to upload.

= javascript_include_tag 'swfupload'
= javascript_include_tag 'upload'
%script{:type => "text/javascript"}
  var swfu;

  // Dom Ready
  $(document).ready(function() {
  // Setup SWFU object
  var settings = {
  =  "upload_url: \"#{photos_url}\","
  flash_url: "/assets/swfupload.swf",

  file_size_limit: "<%= 3.megabytes %>",
  file_types: "*.jpg;",
  file_types_description: "Jpg Image Files",

  file_queued_handler: Upload.file_queued,
  file_dialog_complete_handler: Upload.file_dialog_complete,
  upload_start_handler: Upload.upload_start,
  upload_progress_handler: Upload.upload_progress,
  upload_error_handler: Upload.upload_error,
  upload_success_handler: Upload.upload_success,
  upload_complete_handler: Upload.upload_complete,

  debug: true // Set to true to find out why things aren't working
  };

  swfu = new SWFUpload(settings);

  // Disable Upload Button
  $('#upload').addClass('disabled').attr('disabled', 'true');

  // Add Event Handlers
  $('#browse').click(function() { swfu.selectFiles(); });
  $('#upload').click(function() { swfu.startUpload(); });
  });

%div.buttons
  %button{:id => "browse", :class => "browse"}Browse
  %button{:id => "upload", :class => "upload"}Upload 0 Files
